package br.com.estrategos.dao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public abstract class FabricaConexao {

	private static EntityManagerFactory emf;

	public static EntityManager getEntityManager() {
		if (emf == null) {
			emf = Persistence.createEntityManagerFactory("orion");
		}
		EntityManager em = emf.createEntityManager();
		return em;
	}

	public static void closeEntityManager() {
		emf.close();
	}
}
